#define  _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>

#include <algorithm>
using namespace std;
vector<int>pushii(int n) {
	vector<int>cc;
	for (int i = 1; i <= n; i++) {
		cc.push_back(i);
	}
	return cc;

}
vector<int> Creat(int n) {
	vector<int>o;
	while (n!=0) {
		o.push_back(n % 10);
		n=n / 10;
	}
	reverse(o.begin(), o.end());
	return o;
}
int main()
{
	vector<int>c = pushii(2023);
	
	
	
	int sum = 0;
	int u = 0;
	for (int i = 0; i < c.size(); i++) {
		vector<int>s1 = Creat(c[i]);
	
		for (int j = 0; j < s1.size(); j++) {
			int e = 1;
			 if ((s1[j] == 2 && u != 0)&&(s1[j] == 2 && u != 2)) {
				u = 0;
				e = 0;
			}
			
			 else if (s1[j] == 0 && u != 1) {
				 u = 0;
				 e = 0;
			 }
			 else if (s1[j] == 3 && u != 3) {
				 u = 0;
				 e = 0;
			 }
			if (s1[j] == 2 && u == 0) {
				u++;
			}
			
			
			else if (s1[j] == 0 && u == 1) {
				u++;
			}
			
			else if (s1[j] == 2 && u == 2) {
				u++;
			}
			
			if (s1[j] == 3 && u == 3) {
				u = 0;
				sum++;
			}
			
		}
	}
	cout << sum;
	return 0;
}